﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CI.Models.Data;
using CI.Models.Production;
using CI.Models.Production.Interfaces;

namespace CI.UI.Prototypes
{
    public class ProductionViewModel
    {

        public IStaticDataRepository<Item> Repository { get; private set; }

        private List<dynamic> _availableItems;
        public PIModelOptions PIModelOptions { get; private set; }
        private PIJobModelManager _piManager = new PIJobModelManager();

        public ProductionViewModel(IStaticDataRepository<Item> repository)
        {
            Repository = repository;
            _piManager.ProductionRepo = Repository;
            PIModelOptions = new PIModelOptions { MinimumManufacturingLevel = PIManufacturingLevel.Resource};
        }

        public string[] LayoutAlgorithms = new[] { "Circular", "Tree", "FR", "BoundedFR", "KK", "ISOM", "LinLog", "CompoundFDP" };

        public IEnumerable<dynamic> AvailableItems
        {
            get
            {
                if (_availableItems == null)
                {
                    _availableItems = new List<dynamic>();
                    _availableItems.AddRange(Repository.All.Where(r=>r.Schematic!=null));
                }

                return _availableItems;
            }
        }


    }
}
